<template>
  <div style="margin-bottom: 66px">
    <nav-bar id="nav" :title="title" :left-text="leftText" :right-text="rightText" :left-arrow="left"
      @click-left="clickLeft" fixed>
    </nav-bar>
  </div>
</template>

<script>
import { NavBar, Icon } from "vant";
import apicloud from "@/libs/apicloud";

export default {
  name: "navbar",
  components: { NavBar, Icon },
  props: ["title", "left", "right", "leftText", "rightText"],
  data: function () {
    return {};
  },
  mounted() {
    // Should be at this time
    apicloud.fixStatusBar(apicloud.dom("#nav")); // Fix the APP header bug
    // let navHeight = apicloud.dom("#nav").offsetHeight;console.log(navHeight);
    // this.divCss["margin-bottom"] = navHeight+'px';
    // this.$nextTick(function () {
    //     //获取头部NavBar高度
    //   let navHeight = apicloud.dom("#nav").offsetHeight;console.log(navHeight);
    //   this.divCss["margin-bottom"] = navHeight+'px';
    // })
  },
  methods: {
    clickLeft() {
      try {
        // this.$ac.closeWin({
        //   type: "movein",
        //   subType: "from_left",
        //   name: 'home'
        // });

        api.openWin({
          name: "home",
          url: "./home.html",
          reload: true
        });
      } catch (error) {
        alert(error);
      }
    },
  },
};
</script>

<style>
.van-nav-bar {
  height: auto !important;
  background-color: #114f79;
  font-family: "微软雅黑";
}

.van-nav-bar__title {
  color: #ffffff;
  font-size: 18px;
}

.van-nav-bar__text {
  color: #ffffff;
  margin-top: 0px;
}
</style>
